2022-11-22

In the morning

library(survival)
library(KMsurv)
library(ggplot2)
library(ggpubr)
library(survminer)
library(plotly)
library(muhaz)
library(ggthemes)

Getting up

Setting Up Info for Analysis

Loading in Data

Kaplan-Meier Curves

# # Kaplan Meier Curves on Region
# pneumon$urban <- as.factor(pneumon$urban)
# KMobj <- survfit(pneu.surv ~ 1, data = pneumon)
# 
# 
# 
# KMplot <- ggsurvplot(KMobj) + labs(title = "Time to Hospital by Region")
# ggplotly(KMplot[[1]])
# 
# coxph(pneu.surv ~ factor(race), data = pneumon)
data(std)

any(is.na(std))
## [1] FALSE
infect <- std$iinfct
surv_object <- Surv(time = std$time, event = std$rinfct)

KMobj <- survfit(surv_object ~ iinfct, data = std)

KMplot <- ggsurvplot(KMobj) + labs(title = "Kaplan-Meier Curves for Initial Infection Type") 
ggplotly(KMplot[[1]])